package TextBookCode.unit2.unit2_1;

public class ReflectServiceImpl {
    public ReflectServiceImpl() {
    }

    public void sayHello(String name) {
        System.err.println("Hello " + name);
    }

    public ReflectServiceImpl getInstance() {
        ReflectServiceImpl object = null;

        try {
            object = (ReflectServiceImpl)
                    Class.forName("TextBookCode.unit2.unit2_1.ReflectServiceImpl").
                            newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) {
            ex.printStackTrace();
        }

        return object;
    }

}
